home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Mops 2.5 / Quick Edit ƒ / Subject Glossary / Toolbox < prev   
Encoding:
Text File  |  1992-11-25  |  3.3 KB  |  99 lines  |  [TEXT/MSET]

  1. NAMED TOOLBOX ACCESS
  2.  
  3.  
  4.  
  5. CALL    --  : TrapName
  6.     Used to compile a call to a Macintosh Toolbox routine.  Simply follow 
  7.     call with the name of the routine.  Compilation only.  
  8.  
  9. GLOBAL    -- addr  : globalname
  10.     When followed by the name of a Mac system global variable, leaves the 
  11.     memory location.  Example: global ticks @ returns the number of ticks 
  12.     since system startup.  
  13.  
  14. KONST    -- n  : konstName
  15.     Returns a Mac system constant.  For example, konst kAEQuitApplication 
  16.     will return the event id 'quit' on the stack.  
  17.  
  18.  
  19.  
  20.  
  21. STACK MANIPULATION FOR TOOLBOX CALLS
  22.  
  23. We need the following words to make it easy to convert our Mops stack items,
  24. which are always 32-bit, to and from 16-bit items as required by many Mac
  25. Toolbox calls.
  26.  
  27. I->L    16-bit-num -- 32-bit-num
  28.     Converts the 16-bit half-cell on top of stack into a full 32-bit Mops 
  29.     cell, extending the sign bit.  i->l is useful in handling the result 
  30.     from Macintosh ROM routines that return a 16-bit signed integer on the 
  31.     stack.  i->l differs from Extend in that i->l pushes two bytes onto 
  32.     the stack while extending the sign, whereas extend only extends the 
  33.     sign of a 16-bit integer contained in the 32-bit cell on top of stack, 
  34.     converting it into a 32-bit signed integer.  Word0, a related word, 
  35.     pushes two zero bytes onto the stack.  
  36.  
  37. MAKEINT    32-bit-num -- 16-bit-num
  38.     Drops the higher 16 bits of the number on top of the stack.  This is 
  39.     handy in Toolbox calls that require an Int value. 
  40.     
  41. W    -- 16-bit-value  : value
  42.     Useful for compiling a 16 bit number for toolbox calls.  Same as n 
  43.     makeint except n must be known at compilation time.  More compact than 
  44.     using n makeint.  
  45.  
  46. WORD0    n -- 16-zero-bits
  47.     Pushes 16 zero bits (hex 0000) onto the stack.  You can use word0 to 
  48.     prepare for a Toolbox function call for the result, if the function 
  49.     returns a Toolbox integer.  
  50.  
  51. TBOOL    b -- tbool
  52.     Makes a Mops boolean into a Toolbox boolean.  Note that tbool should 
  53.     only be used as a setup for a Toolbox call as the stack will be 
  54.     mis-aligned until the Toolbox call is done.  
  55.  
  56.  
  57. PACK    x y  -- x:y
  58.     Packs two 32-bit numbers into one 32-bit number.  Only the lower 16 
  59.     bits of x and y are used.  You can use pack to convert a coordinate 
  60.     point into a Toolbox-compatible point.  
  61.  
  62. UNPACK    x:y -- x y
  63.     Unpacks a Toolbox point and puts the two integers on the stack.  
  64.     Unpack is the opposite of pack.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. MISCELLANEOUS
  71.  
  72. STR255  addr len -- ^buf255  
  73.     Converts text beginning at addr for len characters to a str255 type
  74.     string at buf255, leaving the addr of buf255.  Note that you should use
  75.     the string right away as the next call to str255 will overwrite the 
  76.     buffer.
  77.  
  78.  
  79. :PROC    --  : name
  80.     Begins compilation of a word that to the Toolbox behaves like a Pascal 
  81.     procedure or function.  You can use a :proc word when a Toolbox 
  82.     routine requires a procedural argument.  
  83.  
  84. ;PROC    --
  85.     Ends compilation of word defined with :proc
  86.  
  87. 'TYPE    -- 4bytestring  :  XXXX
  88.     Given 4 ascii characters in the input stream, a 4bytestring will 
  89.     be left on the stack.  This data type is also known as a PACKED 
  90.     ARRAY[1..4] OF CHAR; in Pascal.  
  91.  
  92. TRAP$    --  :  trap#
  93.     Compiles a toolbox trap if the Tools module is not loaded.  The new 
  94.     syntax is, e.g.trap$ A9FF 
  95.  
  96. FDOS$    --  : trap#
  97.     Compiles a toolbox trap for I/O if the Tools module is not loaded.  
  98.     The new syntax is, e.g.trap$ fdos$ A000 
  99.